import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "/employee-data",
  },
  {
    path: "/employee-data",
    name: "EmployeeData",
    component: () => import("@/views/EmployeeDataView.vue"),
    meta: { title: "员工数据整合分析" },
  },
  {
    path: "/position",
    name: "PositionData",
    component: () => import("@/components/PositionManagement.vue"),
    meta: { title: "岗位要求管理" },
  },
  {
    path: "/competency",
    name: "Competency",
    component: () => import("@/views/CompetencyView.vue"),
    meta: { title: "岗位胜任力判断" },
  },
  {
    path: "/development",
    name: "Development",
    component: () => import("@/views/DevelopmentView.vue"),
    meta: { title: "能力评估与发展建议" },
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

router.beforeEach((to, from, next) => {
  document.title = to.meta.title || "员工能力评估系统";
  next();
});

export default router;
